#include <stdio.h>
#include <stdlib.h>

// Define a "class" structure
typedef struct {
    int data;
    void (*print)(void*);
} MyClass;

// Constructor for MyClass
//cotr
MyClass* MyClass_create(int data) {
    MyClass* obj = (MyClass*)malloc(sizeof(MyClass));
    obj->data = data;
    obj->print = NULL;
    return obj;
}

// Method for printing data
void MyClass_print(void* self) {
    MyClass* obj = (MyClass*)self;
    printf("Data: %d\n", obj->data);
}

int main() {
    // Create an instance of MyClass
    MyClass* obj = MyClass_create(42);

    // Set the print method
    obj->print = MyClass_print;

    // Call the print method
    obj->print(obj);

    // Clean up
    free(obj);

    return 0;
}